// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import QtQuick 1.0

Item {
    width: 274
    height: 62
    id:root

    signal action(string name)
    signal fill(variant lst)
    signal clear()

    ListModel{
        id:actionsModel
        ListElement{
            action:"bet"
            action_name:"Bet"
        }
    }

    Image{
        anchors.fill: parent
        fillMode: Image.Center
        source: "images/ui/actions_panel.png"
    }

    Component{
        id:actionComponent
        ButtonListElement{
            id:button
            action: model.action
            text: model.action_name
            onClick: root.action(act)
        }
    }

    ListView{
        model: actionsModel
        interactive: false
        orientation: ListView.Horizontal
        spacing: 12
        width:parent.width
        height: parent.height
        x:17
        y:12
        delegate:  actionComponent
    }
    onClear: {
        actionsModel.clear();
    }

    onFill: {
        actionsModel.clear();
        console.log(lst);
        for (var i in lst){
            var obj;
            if (lst[i]=="blind") obj = {'action':'blind','action_name':'Blind'}
            if (lst[i]=="dblind") obj = {'action':'dblind','action_name':'DBlind'}
            if (lst[i]=="fold") obj = {'action':'fold','action_name':'Fold'}
            if (lst[i]=="call") obj = {'action':'call','action_name':'Call'}
            if (lst[i]=="bet") obj = {'action':'bet','action_name':'Bet'}
            if (lst[i]=="check") obj = {'action':'check','action_name':'Check'}
            actionsModel.append(obj);
        }
    }
}
